<template>
  <!-- <a v-if="itemData.url" :href="itemData.url" class="stadium-item">
    <div class="content-box">
        <div class="title-box">
          <div class="title">{{itemData.venueName}}</div>
          <div class="last-time" v-if="itemData.newOrderTime">{{itemData.newOrderTime}}前有人预定</div>
        </div>
        <div class="address">
          <div class="address-content">{{itemData.venueAddress}}</div>
          <van-tag class="distance" type="primary">{{itemData.distance}}km</van-tag>
        </div>
        <div class="score">评分 <van-rate readonly :size="11" :value="itemData.totalScore" :count="itemData.totalScore" /></div>
        <div class="sports">
          <van-tag class="sport-tag" plain v-for="(sport,index) in itemData.sportType" :key="index">{{sport.sportsTypeName}}</van-tag>
        </div>
    </div>
  </a> -->
  <router-link :to="{name: 'stadium-detail', params:{id: itemData.venueId}}" class="stadium-item" >
      <div class="cover" :style="{backgroundImage:`url(${itemData.venueMainPic})`}"></div>
      <div class="content-box">
          <div class="title-box">
            <div class="title">{{itemData.venueName}}</div>
            <div class="last-time" v-if="itemData.newOrderTime">{{itemData.newOrderTime}}前有人预定</div>
          </div>
          <div class="address">
            <div class="address-content">{{itemData.venueAddress}}</div>
            <van-tag class="distance" type="primary">{{itemData.distance | distanceFilter}}</van-tag>
          </div>
          <div class="score">评分 <van-rate  readonly :size="11" :value="itemData.totalScore" :count="itemData.totalScore" /></div>
          <div class="sports">
            <van-tag class="sport-tag" plain v-for="(sport,index) in itemData.sportType" :key="index">{{sport}}</van-tag>
          </div>
      </div>
  </router-link>

</template>

<script>
import { Rate } from 'vant'
export default {
  name: 'stadium-item',
  components: {
    [Rate.name]: Rate
  },
  props: {
    itemData: Object
  },
  filters: {
    distanceFilter (value) {
      return value >= 1000 ? `${parseFloat(value / 1000).toFixed(2)}km` : `${value}m`
    }
  }
}
</script>

<style scoped lang="less">
.stadium-item{
  display: flex;
  align-items: center;
  box-shadow: 0px 0px 17.64px 0.36px rgba(44, 44, 44, 0.09);
  border-radius: 5px;
  margin: 12px 12px;
  padding: 8px;

  .cover{
    width: 209/2px;
    height: 158/2px;
    flex: 0 0 209/2px;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
  }

  .content-box{
    flex: 1;
    width: 0;
    margin-left: 12px;
    font-size: 22/2px;
    color: #484848;
    line-height: 14px;
  }
  .title-box{
    display: flex;
    align-items: center;
    justify-content: space-between;
    .title {
      font-size: 28/2px;
      line-height: 23px;
      color: #353434;
      margin: 0;
      font-weight: bold;
      .text-overflow();
    }
    .last-time{
      text-align: right;
      color: #9D9D9D;
    }
  }
  .address{
    margin-top: 2px;
    display: flex;
    align-items: center;
    .address-content{
      .text-overflow();
    }
    .distance{
      padding-top: 2px;
      padding-bottom: 2px;
      margin-left: 4px;
    }
  }
  .score{
    display: flex;
    margin-top: 5px;
  }
  .sports{
    margin-top: 5px;
    .sport-tag{
      padding-left: 8px;
      padding-right: 8px;
      padding-top: 2px;
      padding-bottom: 2px;
      line-height: 1;
      margin-right: 6px;
      margin-top: 2px;
      &:last-child{
        margin-right: 0;
      }
    }
  }
}
</style>
